package com.yuanduo_app.ui.map.adapter;

import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.xujl.fastlib.base.BaseRvAdapter;

import com.yuanduo_app.R;
import com.yuanduo_app.entity.SuggestionEntity;

import org.jetbrains.annotations.NotNull;

import java.util.List;

import androidx.annotation.Nullable;

public class SuggestionAdapter extends BaseRvAdapter<SuggestionEntity> {
    private String keyword = "";

    public SuggestionAdapter (@Nullable List<SuggestionEntity> data) {
        super(R.layout.item_suggestion_address, data);
    }

    @Override
    protected void convert (@NotNull BaseViewHolder holder, SuggestionEntity suggestionEntity) {
        //关键字变色
//        holder.setText(R.id.tv_city, ViewHelper.matcherSearchText(ResUtils.getColor(R.color.text_theme), suggestionEntity.getLocation().getName(), keyword))
        holder.setText(R.id.tv_city, suggestionEntity.getLocation().getName())
                .setText(R.id.tv_desc, suggestionEntity.getLocation().getStreet());
    }

    public void setKeyword (String keyword) {
        this.keyword = keyword;
    }

    public String getKeyword () {
        return keyword;
    }
}
